<?php
App::uses('AppModel', 'Model');
/**
 * Grade Model
 *
 * @property Classroom $Classroom
 */
class Grade extends AppModel {

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'name';


	//The Associations below have been created with all possible keys, those that are not needed can be removed

	/**
     * hasMany associations
     *
     * @var array
     */
    public $hasMany = array(
	  'Classroom' => array(
		'className' => 'Classroom',
		'foreignKey' => 'grade_id',
		'dependent' => false,
		'conditions' => '',
		'fields' => '',
		'order' => '',
		'limit' => '',
		'offset' => '',
		'exclusive' => '',
		'finderQuery' => '',
		'counterQuery' => ''
	  )
    );
    
    /**
     * validate model
     * 
     * @var array
     */
    public $validate = array(
    	'name' => array(
    	    'notEmpty' => array(
    	        'rule' => 'notEmpty',
    	        'message' => 'Grade\'s name is required'
    	    ),
    	    'isUnique' => array(
    	        'rule' => 'isUnique',
    	        'message' => 'Grade\'s name was existed! Please enter another.'
    	    ),
        )
    );

}
